package ema.tpjee.banking.model;

import java.io.Serializable;



public class Customer implements Serializable {
	
	private static final long serialVersionUID = 7204194554910037494L;


	private int id;

	private String name;
	private String forName;
	private String address;
	private String zipCode;


	private Bank bank;
	

	private City city;

	public City getCity() {
		return city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	public Customer(String name, String forName, String address, String zipCode) {
		this();
		this.name = name;
		this.forName = forName;
		this.address = address;
		this.zipCode = zipCode;

	}

	public Customer(String name) {
		this();
		this.name = name;
	}

	public Customer() {
		super();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getForName() {
		return forName;
	}

	public void setForName(String forName) {
		this.forName = forName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public String toString() {
		String result = id + " " + forName + " " + name;
		if (getCity()!=null)
			result += ";"+getCity().toString();
		else 
			result +=";city=null";
		return result;
	}

	public void setBank(Bank b) {
		this.bank = b;
	}

	public Bank getBank() {
		return bank;
	}
	
	@Override
	public boolean equals(Object other) {
		if (!(other instanceof Customer))
			return false;
		return this.id == ((Customer)other).id;
	}

	@Override
	public int hashCode() {
		return new Integer(id).hashCode();
	}

}
